package com.ctshk.sapp.system.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.model.PageResponse;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.system.dto.MainDataAirSystemDTO;
import com.ctshk.rpc.system.req.MainDataAirSystemAddReq;
import com.ctshk.rpc.system.req.MainDataAirSystemListReq;
import com.ctshk.rpc.system.req.MainDataAirSystemUpdateReq;
import com.ctshk.rpc.system.service.IMainDataAirSystemService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 机票外挂系统主数据表 前端控制器
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-04-07
 */
@ApiModel(value = "机票外挂系统主数据")
@RestController
@RequestMapping("/main-data-air-system")
public class MainDataAirSystemController extends BaseController {



    @DubboReference
    private IMainDataAirSystemService iMainDataAirSystemService;

    @ApiOperation(value = "新增机票外挂系统", notes = "新增机票外挂系统")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.ADD, operTitle = "新增机票外挂系统", operDesc = "新增机票外挂系统")
    @PostMapping(value="/add")
    public Result add(@RequestBody @Valid MainDataAirSystemAddReq req){
        return  iMainDataAirSystemService.add(req,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "查询机票外挂系统列表", notes = "查询机票外挂系统列表")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.QUERY, operTitle = "查询机票外挂系统列表", operDesc = "查询机票外挂系统列表")
    @PostMapping(value="/list")
    public Result<PageResponse<MainDataAirSystemDTO>> list(@RequestBody MainDataAirSystemListReq req){
        return  iMainDataAirSystemService.list(req);
    }

    @ApiOperation(value = "修改外挂系统状态", notes = "修改外挂系统状态")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.UPDATE, operTitle = "修改外挂系统状态", operDesc = "修改外挂系统状态")
    @PostMapping(value="/update-status")
    public Result updateStatus(@RequestBody Long id){
        return  iMainDataAirSystemService.updateStatus(id);
    }

    @ApiOperation(value = "修改外挂系统信息", notes = "修改外挂系统信息")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.UPDATE, operTitle = "修改外挂系统信息", operDesc = "修改外挂系统信息")
    @PostMapping(value="/update")
    public Result update(@RequestBody MainDataAirSystemUpdateReq req){
        return  iMainDataAirSystemService.update(req,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "外挂系统详情", notes = "外挂系统详情")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.QUERY, operTitle = "外挂系统详情", operDesc = "外挂系统详情")
    @PostMapping(value="/info/{id}")
    public Result<MainDataAirSystemDTO> update(@PathVariable @NotNull Long id){
        return  iMainDataAirSystemService.info(id);
    }
}
